const http = require('http');
const fs = require('fs');
const path = require('path');

const server = http.createServer((req, res) => {
    console.log(req.headers);
    // 读取index.html并返回给客户端
    res.end(fs.readFileSync(path.resolve(__dirname, 'index.html')));
})

server.listen(3000);
